package com.yuexunit.mobilenurse.util;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by work-jx on 2015/12/16.
 */
public class CreateJson {

    //登录
    public static String Login_Json(String uid,String password)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_login");

            JSONObject request = new JSONObject();
            request.put("logid", uid);
            request.put("logpass", password);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //病人列表
    public static String Patlist_Json(String wardno)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_patlist");

            JSONObject request = new JSONObject();
            request.put("wardno", wardno);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //单个病人信息
    public static String Patinfo_Json(String visit_no)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_patinfo");
            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);
            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }


    //病人检验申请单列表
    public static String Aslist_Json(String visit_no)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_as_list");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //病人检验报告单
    public static String Asrpt_Json(String requestno)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_as_rpt");

            JSONObject request = new JSONObject();
            request.put("requestno", requestno);

            body.put("head",head);
            body.put("request",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //病人检查申请单列表
    public static String Exlist_Json(String visit_no)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_ex_list");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //病人检查报告单
    public static String Exrpt_Json(String requestno)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_ex_rpt");

            JSONObject request = new JSONObject();
            request.put("requestno", requestno);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //病人费用清单查询
    public static String Patfee_Json(String visit_no,String startdate,String endate)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_pat_fee");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);
            request.put("startdate", startdate);
            request.put("enddate", endate);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //获取病人当日可执行医嘱
    public static String Orderlist_Json(String visit_no)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_order_list");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }


    //病人医嘱执行-4合1
    public static String Orderexec_Json(String visit_no,String barcode,int execempid,String exectime,String exectype)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_order_exec");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);
            request.put("barcode", barcode);
            request.put("execempid", execempid);
            request.put("exectime", exectime);
            request.put("exectype", exectype);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //摆药
    public static String Orderexec_Json1(String visit_no,String barcode,int execempid,String exectime,String exectype)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_order_exec1");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);
            request.put("barcode", barcode);
            request.put("execempid", execempid);
            request.put("exectime", exectime);
            request.put("exectype", exectype);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //化药
    public static String Orderexec_Json2(String visit_no,String barcode,int execempid,String exectime,String exectype)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_order_exec2");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);
            request.put("barcode", barcode);
            request.put("execempid", execempid);
            request.put("exectime", exectime);
            request.put("exectype", exectype);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //执行
    public static String Orderexec_Json3(String visit_no,String barcode,int execempid,String exectime,String exectype)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_order_exec3");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);
            request.put("barcode", barcode);
            request.put("execempid", execempid);
            request.put("exectime", exectime);
            request.put("exectype", exectype);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //停止
    public static String Orderexec_Json5(String visit_no,String barcode,int execempid,String exectime,String exectype)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_order_exec5");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);
            request.put("barcode", barcode);
            request.put("execempid", execempid);
            request.put("exectime", exectime);
            request.put("exectype", exectype);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //病人医嘱执行_出院
    public static String Orderexec_outMedicine_Json(String visit_no,String zh,String execempid,String exectime)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_order_cy");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);
            request.put("zh", zh);
            request.put("execempid", execempid);
            request.put("exectime", exectime);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //病人检验标本采集
    public static String Ascollect_Json(String visitno,String barcode,int execempid,String exectime,String exectype)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_as_collect");

            JSONObject request = new JSONObject();
            request.put("visit_no", visitno);
            request.put("barcode", barcode);
            request.put("execempid", execempid);
            request.put("exectime", exectime);
            request.put("exectype", exectype);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //获取体征 HIS5.0
    public static String Signlist_Json(String inpNo,String interval,String date)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "kmhs_enr_list");

            JSONObject request = new JSONObject();
            request.put("inpNo", inpNo);
            request.put("interval",interval);
            request.put("date", date);

            body.put("head",head);
            body.put("request",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //病人体征
    public static String Sign_Json(String inpNo,String timestamp,String recorder,String signData,String timepoint)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_enr_record");

            JSONObject request = new JSONObject();
            request.put("inpNo", inpNo);
            request.put("timestamp", timestamp);
            request.put("recorder", recorder);
            request.put("signData", signData);
            request.put("timepoint", timepoint);

            body.put("head",head);
            body.put("request",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }


    //远程日志
    public static String LOG_JSON(String url,String type,String params,String result)
    {
        JSONObject main = new JSONObject();
        try {
            main.put("url", url);
            main.put("type", type);
            main.put("params", params);
            main.put("result", result);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }


    //皮试列表
    public static String SkinTestList_Json(String visit_no)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_zybr_ps");

            JSONObject request = new JSONObject();
            request.put("Visitno", visit_no);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //皮试列表
    public static String SkinTestDetail_Json(String psh)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "MHS_ZYBR_ps_xq");

            JSONObject request = new JSONObject();
            request.put("psh", psh);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //皮试开始
    public static String SkinTest_Start_Json(String Psh,String Pspc,String Pszxr)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_zybr_psks");

            JSONObject request = new JSONObject();
            request.put("Psh", Psh);
            request.put("Pspc", Pspc);
            request.put("Pszxr", Pszxr);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

    //皮试结束
    public static String SkinTest_End_Json(String Psh,String Psjg,String Psfhr1,String Psfhsj1,String Psfhr2,String Psfhsj2)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_zybr_psjs");

            JSONObject request = new JSONObject();
            request.put("psh", Psh);
            request.put("psjg", Psjg);
            request.put("psfhr1", Psfhr1);
            request.put("psfhsj1", Psfhsj1);
            request.put("psfhr2", Psfhr2);
            request.put("psfhsj2", Psfhsj2);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }


    //获取病人当日中医护理数据
    public static String Medicinelist_Json(String visit_no)
    {
        JSONObject main = new JSONObject();
        try {
            JSONObject body = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("userid", "mhs");
            head.put("password", "mhs");
            head.put("trans_no", "mhs_zlyz_list");

            JSONObject request = new JSONObject();
            request.put("visit_no", visit_no);

            body.put("head",head);
            body.put("resquest",request);
            main.put("body",body);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return main.toString();
    }

}
